
/**
* 项目通用柱状图
* X轴为category，Y轴value
*/
function bar(dataJson, color) {
    var seriesType = []
    //第一行legend标签数据
    var category = dataJson[0]
    for (var i = 1; i < category.length; i++) {
        seriesType.push({
            type: 'bar',
            barWidth: 5,
            barGap: '40%',
            itemStyle: {
                borderRadius: [5, 5, 0, 0],
            },
        })
    }

    option = {
        legend: {
            // type: 'scroll',
            formatter: commonLegendFormatter(name,category),
            itemWidth: 6,
            itemHeight: 6,
            textStyle: {
                color: color,
                fontSize: 10,
            },
            padding: [0, 2],
        },
        tooltip: commonTooltip,
        dataset: {
            source: dataJson
        },
        xAxis: commonXAxis(category),
        yAxis: commonYAxis(color),
        grid: commonGrid(category),
        // Declare several bar series, each will be mapped
        // to a column of dataset.source by default.
        series: seriesType
    };

    return option
}


/**
* 项目通用柱状图
* X轴为category，Y轴value
*/
function stickBar(dataJson, color) {
    var seriesType = []
    //第一行legend标签数据
    var category = dataJson[0]
    for (var i = 1; i < category.length; i++) {
        seriesType.push({
            type: 'bar',
            stack: 'value',
            barGap: '40%',
        })
    }

    option = {
        legend: {
            // type: 'scroll',
            formatter: commonLegendFormatter(name,category),
            itemWidth: 6,
            itemHeight: 6,
            textStyle: {
                color: color,
                fontSize: 10,
            },
            padding: [0, 2],
        },
        tooltip: commonTooltip,
        dataset: {
            source: dataJson
        },
        xAxis: commonXAxis(color),
        yAxis: commonYAxis(color),
        grid: commonGrid(category),
        // Declare several bar series, each will be mapped
        // to a column of dataset.source by default.
        series: seriesType
    };

    return option
}
